home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Games of Daze
/
Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso
/
x2ftp
/
msdos
/
libs
/
tool6v12
/
demomou.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
1994-07-01
|
3KB
|
118 lines
Program DemoMouse;
{ Purpose....... Demonstrates the use of the following units: mouse
Comments...... The user-defined graphics cursor was defined using MCD
written by the same author. It is freely available when
you register your Toolbox.
Author........ Thayne Breetzke
Date.......... 31 March 1994 (modified 1 July 1994) }
Uses
Crt,
Mouse,
Input,
Graph;
Const
Cross: Array32Word = ($FFFF,$FFFF,$FC3F,$FC3F,$FC3F,$FC3F,$C003,$C003,
$C003,$C003,$FC3F,$FC3F,$FC3F,$FC3F,$FFFF,$FFFF,
$0000,$0000,$0000,$0180,$0180,$0180,$0180,$1E78,
$1E78,$0180,$0180,$0180,$0180,$0000,$0000,$0000);
Var
GrDriver, GrMode, GrError: Integer;
Procedure UpdateProc(Var Key: Char; Var Extended: Boolean; UpdateVar: Word); far;
Begin
end;
Procedure DoGraphicDemo;
Begin
GrDriver := Detect;
InitGraph(GrDriver,GrMode,'C:\TP\BGI'); {Change directory if necessary...}
If MInstalled then
Begin
OutTextXY(200,470,'Press right button to exit');
SetGraphicsCursor(8,8,Cross);
ShowMouse;
Repeat
If ButtonPressed = 1 then
Begin
HideMouse;
Circle(MouseXCor,MouseYCor,17);
ShowMouse;
{You can wait for a vertical retrace here to reduce flicker}
end
until ButtonPressed = 2;
end;
CloseGraph
end;
Procedure DoTextDemo;
Var
Key : Char;
Extended : Boolean;
Horiz,
Vert : Integer;
Begin
ClrScr;
Writeln('Use the cursor keys or the mouse to move the cursor. Press ESC to exit.');
ResetMouseMovement;
Horiz := 0;
Vert := 0;
Repeat
If (Horiz = 0) and (Vert = 0) then
Begin
GetKey(Key,Extended,[#27],[#72,#80,#75,#77],False,False,UpdateProc,0);
ReadMouseMovement(Horiz,Vert);
end
else
If Horiz < 0 then
Begin
Key := #75;
Inc(Horiz);
end
else
If Horiz > 0 then
Begin
Key := #77;
Dec(Horiz);
end
else
If Vert < 0 then
Begin
Key := #72;
Inc(Vert);
end
else
If Vert > 0 then
Begin
Key := #80;
Dec(Vert);
end;
Case Key of
#72: If WhereY > 1 then
GotoXY(WhereX,WhereY-1);
#80: If WhereY < 25 then
GotoXY(WhereX,WhereY+1);
#75: If WhereX > 1 then
GotoXY(WhereX-1,WhereY);
#77: If WhereX < 80 then
GotoXY(WhereX+1,WhereY);
end;
until (Key = #27)
end;
Begin
DoGraphicDemo;
DoTextDemo;
ClrScr;
end.